package com.freestyle.nettychat.session.service;

import com.freestyle.nettychat.chat.service.ChatService;
import com.freestyle.redis.expire.RedisKeyExpirationListener;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * Created by rocklee on 2022/2/4 12:19
 */
public class RedisSessionServiceFactory extends AbstractSessionServiceFactory {
  private RedisTemplate<String,Object> redisTemplate;
  private ChatService chatService;
  private RedisKeyExpirationListener redisKeyExpirationListener;

  public RedisSessionServiceFactory(RedisTemplate<String, Object> redisTemplate, ChatService chatService,RedisKeyExpirationListener redisKeyExpirationListener) {
    this.redisTemplate = redisTemplate;
    this.chatService=chatService;
    this.redisKeyExpirationListener=redisKeyExpirationListener;
  }

  @Override
  public SessionService buildSessionService() {
    return new RedisSessionService(redisTemplate,chatService,redisKeyExpirationListener);
  }
}
